<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->id();
            $table->string('nickname')->comment('昵称');
            $table->string('head')->comment('头像');
            $table->string('country_code')->default('+86')->comment('手机号国家代码');
            $table->integer('mobile')->comment('手机号');
            $table->integer('balance')->comment('余额，单位分');
            $table->char('password', 32)->default('0')->comment('密码');
            $table->tinyInteger('status')->default(1)->comment('用户状态：0删除，1正常，2禁用');
            $table->timestamps();
        });
        DB::statement("alter table `users` comment'用户表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
